﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Wix.Aura.Common;
using Wix.Aura.UnitTests.Tools;
using Wix.Aura.Common.CustomTypes;

namespace Wix.Aura.UnitTests.Common {
	[TestFixture]
	public class CreateFolderSerialization {
		[SetUp]
		public void SetUp(){
			folder = new CreateFolder();
		}

		public CreateFolder folder;

		[Test]
		public void EmptyCreateFolder() {
			XmlAssert.AreEqual("<CreateFolder />", folder);
		}

		[Test]
		public void AllAttributes() {
			folder.Directory = "C:\\ABC";
			XmlAssert.AreEqual(@"<CreateFolder Directory=""C:\ABC"" />", folder);
		}

		[Test]
		public void CreateFolderWithPermission() {
			folder.Permission.Add(new Permission("Wonisch"));
			XmlAssert.AreEqual(@"<CreateFolder><Permission User=""Wonisch"" /></CreateFolder>", folder);
		}

		[Test]
		public void CreateFolderWithPermissionEx() {
			folder.PermissionEx.Add(new PermissionEx("TestData"));
			XmlAssert.AreEqual(@"<CreateFolder><PermissionEx Sddl=""TestData"" /></CreateFolder>", folder);
		}

		[Test]
		public void CreateFolderWithShortcut() { 

			folder.Shortcut.Add(new Shortcut("short", new LongFileNameType("long")));
			XmlAssert.AreEqual(@"<CreateFolder><Shortcut Id=""short"" Name=""long"" /></CreateFolder>", folder);
		}
	}
}
